package org.example.myerp.service.serviceimpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.example.myerp.mapper.productDesign.customSetup.ProlevelMapper;
import org.example.myerp.pojo.PageMyself;
import org.example.myerp.pojo.*;
import org.example.myerp.service.ProlevelService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * ��Ʒ����ҵ���ҵ���
 *
 * @author DELL
 *
 */
@Service
public class ProlevelServiceImpl implements ProlevelService {
	@Autowired
    ProlevelMapper prolevelMapper;

	/**
	 *  ��ѯȫ����Ʒ������Ϣ
	 */
	@Override
	public List<Prolevel> getFindProlevelsAll() {
		List<Prolevel> list = prolevelMapper.findProlevelsAll();
		return list;
	}

	/**
	 * ��ҳ��ѯ��Ʒ����ȫ����Ϣ
	 */
	@Override
	public PageMyself<Prolevel> findProlevelByPagerMessage(Integer pageNum, Integer pageSize) {
		// �洢�������в�������
		Map params = new HashMap<String, Object>();
		params.put("pageNum", pageNum);
		params.put("pageSize", pageSize);
		// ������ҳ�����࣬��Ϊ����ֵ
		PageMyself<Prolevel> page = new PageMyself<Prolevel>();
		if(pageNum != null && pageSize != null) {
			//���õ�ǰҳ���ҳ��С
			page.setPageNum(pageNum);
			page.setPageSize(pageSize);
		}
		// ��ȡ��ǰҳ����
		List<Prolevel> list = prolevelMapper.findProlevelByPagerMessage(params);
		// ���÷�ҳ���������ʾ����
		page.setRows(list);
		// ����������
		page.setTotal(prolevelMapper.findProlevelTotalNumber());
		return page;
	}

	/**
	 * ��Ӳ�Ʒ������Ϣ
	 */
	@Override
	public Integer getInsertProlevelByNumName(Prolevel prolevel) {
		Integer row = prolevelMapper.insertProlevelByNumName(prolevel);
		return row;
	}

	/**
	 * ɾ����Ʒ������Ϣ
	 */
	@Override
	public Integer getDeleteProlevelByNums(Integer[] levelnums) {
		Integer row = prolevelMapper.deleteProlevelByNums(levelnums);
		return row;
	}
}
